import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../layouts/BasicLayout.vue'
Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
const routes = [{
        path: '/',
        name: 'login',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/login')
    },
    {
        path: '/hms',
        name: 'hms',
        meta: {
            title: '医院管理'
        },
        component: Layout,
        redirect: '/hms/hospital',
        children: [{
                path: 'hospital',
                name: 'hospital',
                meta: {
                    title: '医院列表管理'
                },
                component: () =>
                    import ( /* webpackChunkName: "about" */ '../views/hms/hospital')
            },
            {
                path: 'offic',
                name: 'offic',
                meta: {
                    title: '科室'
                },
                component: () =>
                    import ( /* webpackChunkName: "about" */ '../views/hms/offic')
            }, {
                path: 'doctor',
                name: 'doctor',
                meta: {
                    title: '医生列表管理'
                },
                component: () =>
                    import ( /* webpackChunkName: "about" */ '../views/hms/doctor')
            }, {
                path: 'doctorDetail',
                name: 'doctorDetail',
                meta: {
                    title: '医生详情'
                },
                component: () =>
                    import ( /* webpackChunkName: "about" */ '../views/hms/doctorDetail')
            }
        ]
    },
    {
        path: '/ams',
        name: 'ams',
        meta: {
            title: '患者管理'
        },
        component: Layout,
        redirect: '/ams/amss',
        children: [{
            path: 'amss',
            name: 'amss',
            meta: {
                title: '患者管理列表'
            },
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/ams')
        }]
    },
    {
        path: '/pms',
        name: 'pms',
        meta: {
            title: '审核管理'
        },
        component: Layout,
        redirect: '/pms/amsss',
        children: [{
                path: 'amsss',
                name: 'amsss',
                meta: {
                    title: '审核管理列表'
                },
                component: () =>
                    import ( /* webpackChunkName: "about" */ '../views/pms/index')
            },
            {
                path: 'iindex',
                name: 'iindex',
                component: () =>
                    import ( /* webpackChunkName: "about" */ '../views/pms/iindex')
            }
        ]
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router